From: Tamas K Lengyel Date: Fri, 26 Sep 2014 14:30:37 +0000 (+0200) Subject: mem_event: abstract architecture specific sanity checks X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~4309 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/%22bookmarks://%22Dat/%22http:/www.example.com/cgi/%22https:/%22bookmarks:/%22Dat?a=commitdiff_plain;h=cc5836523905c2ba8605845de9054242e5d28378;p=xen.git mem_event: abstract architecture specific sanity checks Move architecture specific sanity checks into its own function which is called when enabling mem_event. Signed-off-by: Tamas K Lengyel Acked-by: Tim Deegan --- diff --git a/xen/common/mem_event.c b/xen/common/mem_event.c index a0f75b2ac3..16ebdb5d78 100644 --- a/xen/common/mem_event.c +++ b/xen/common/mem_event.c @@ -620,12 +620,7 @@ int mem_event_domctl(struct domain *d, xen_domctl_mem_event_op_t *mec, case XEN_DOMCTL_MEM_EVENT_OP_ACCESS_ENABLE_INTROSPECTION: { rc = -ENODEV; - /* Only HAP is supported */ - if ( !hap_enabled(d) ) - break; - - /* Currently only EPT is supported */ - if ( !cpu_has_vmx ) + if ( !p2m_mem_event_sanity_check(d) ) break; rc = mem_event_enable(d, mec, med, _VPF_mem_access, diff --git a/xen/include/asm-x86/p2m.h b/xen/include/asm-x86/p2m.h index f2842e5378..f6136f9a49 100644 --- a/xen/include/asm-x86/p2m.h +++ b/xen/include/asm-x86/p2m.h @@ -592,6 +592,12 @@ void p2m_mem_event_emulate_check(struct vcpu *v, /* Enable arch specific introspection options (such as MSR interception). */ void p2m_setup_introspection(struct domain *d); +/* Sanity check for mem_event hardware support */ +static inline bool_t p2m_mem_event_sanity_check(struct domain *d) +{ + return hap_enabled(d) && cpu_has_vmx; +} + /* * Internal functions, only called by other p2m code */